<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>房间详情</title>
    <#include "/common/resource.ftl">
    <script type="text/javascript">
        $(function () {
            <#if (params.id)??>
                $.ajaxRequest({
                    url: '${params.contextPath}/web/room/query',
                    data: {id: "${params.id}"},
                    success: function (data) {
                        if (!data.success) {
                            $.message(data.message);
                            return;
                        }
                        var record = data.data;
                        for (var key in record) {
                            $("[field='" + key + "']").html(record[key]);
                        }

                        var bedList = record.bedList, strs = "";
                        for (var i = 0; i < bedList.length; i ++) {
                            var item = bedList[i];
                            item.elderName = item.elderName || "--暂无--";
                            var str = '<tr>' +
                                '<td>{num}</td>' +
                                '<td>{elderName}</td>' +
                                '</tr>';
                            str = str.format(item);
                            strs += str;
                        }
                        $(".bed-list tbody").html(strs);
                    }
                });
            </#if>
        });
    </script>
</head>
<body style="background:#eee;">
<div style="padding:10px;">
    <div class="layui-card">
        <div class="layui-card-header">房间信息</div>
        <div class="layui-card-body">
            <table class="layui-table ui-table">
                <tr>
                    <th>楼层</th>
                    <td field="floorNum">--</td>
                </tr>
                <tr>
                    <th>房间号</th>
                    <td field="roomNum">--</td>
                </tr>
                <tr>
                    <th>类型</th>
                    <td field="typeStr">--</td>
                </tr>
            </table>
        </div>
    </div>
    <div class="layui-card">
        <div class="layui-card-header">床位信息</div>
        <div class="layui-card-body">
            <table class="layui-table bed-list">
                <thead>
                <tr>
                    <th>床位号</th>
                    <th>入住老人</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>贤心</td>
                    <td>2016-11-29</td>
                </tr>
                <tr>
                    <td>许闲心</td>
                    <td>2016-11-28</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
</body>

</html>
